package com.is.dmd.ui.adapters;

import android.support.v4.app.Fragment;

import com.is.dmd.ui.fragments.HomeFragment;
import com.is.dmd.ui.fragments.MineFragment;
import com.is.dmd.ui.fragments.PromotionsFragment;
import com.is.dmd.ui.fragments.YHGContactsFragment;
import com.is.dmd.ui.navigation.FragmentNavigatorAdapter;


/**
 * Created by aspsine on 16/3/31.
 * 底部导航的fragment适配器
 */
public class MainFragmentAdapter implements FragmentNavigatorAdapter {

    private static final String TABS[] = {"HomeFragment", "PromotionsFragment", "BottomSheet", "ContactsFragment", "MineFragment"};

    @Override
    public Fragment onCreateFragment(int position) {
        if (position == 0)
            return HomeFragment.newInstance(TABS[0]);

        else if (position == 1)
            return PromotionsFragment.newInstance(TABS[1]);

        else if (position == 3)
            return YHGContactsFragment.newInstance(TABS[3]);

        else if (position == 4)
            return MineFragment.newInstance(TABS[4]);

        else
            return HomeFragment.newInstance(TABS[0]);
    }

    @Override
    public String getTag(int position) {
        return TABS[position];
    }

    @Override
    public int getCount() {
        return TABS.length;
    }
}
